{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install transformers\n",
    "\n",
    "from transformers import pipeline\n",
    "\n",
    "# Load the question answering model\n",
    "model = pipeline(\"question-answering\", model=\"distilbert-base-cased-distilled-squad\", tokenizer=\"distilbert-base-cased\")\n",
    "\n",
    "# Define a question and a context\n",
    "question = \"What is the capital city of Japan?\"\n",
    "context = \"Japan is an island country in East Asia. Located in the Pacific Ocean, it lies to the east of the Sea of Japan, China, North Korea, South Korea and Russia, stretching from the Sea of Okhotsk in the north to the East China Sea and Taiwan in the south. The capital city of Japan is Tokyo.\"\n",
    "\n",
    "# Get the answer\n",
    "result = model(question=question, context=context)\n",
    "\n",
    "# Print the answer\n",
    "print(f\"Answer: {result['answer']}\")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
